<template>
  <c-back-wrap :loading="loading" go-page="经销商冻结/解冻管理" current-page="账号解冻详情">
    <c-title title="基本信息">
      <CustomerBaseInfoViewArchive v-if="freezeDTO.reportType === 'B'" :detail="detail" />
      <CustomerBaseInfoView v-else :detail="detail" />
    </c-title>
    <c-title title="解冻管理">
      <QupList sep="：" :column="3">
        <QupListItem label="提报类型" :value="freezeDTO.reportType" dict-type-code="CTM_REPORT_TYPE" :prop-enum="{domainCode:'marketing',appCode:'slm'}" />
        <QupListItem v-if="freezeDTO.reportType === 'B'" label="首次执行时间" :value="$trimHMS(freezeDTO.executeTime)" />
        <QupListItem label="解冻类型" :value="freezeDTO.type" dict-type-code="CTM_FREEZE_UNFREEZE_TYPE" :prop-enum="{domainCode:'marketing',appCode:'slm'}" />
        <QupListItem v-if="['D', 'E'].includes(freezeDTO.type)" label="解冻细分类型" :value="freezeDTO.subType" dict-type-code="CTM_UNFREEZE_SUB_TYPE" :prop-enum="{domainCode:'marketing',appCode:'slm'}" />
        <QupListItem label="是否临时解冻" :value="freezeDTO.isTempUnfreeze" dict-type-code="BOOLEANS" :prop-enum="{domainCode:'marketing',appCode:'slm'}" />
        <QupListItem v-if="[1,'1'].includes(freezeDTO.isTempUnfreeze)" label="预计关闭时间" :value="freezeDTO.preCloseTime" />
        <QupListItem label="解冻原因" :value="freezeDTO.cause" :span="24" />
        <QupListItem label="备注" :value="freezeDTO.remark" :span="24" />
        <QupListItem label="是否涉及报图" :value="freezeDTO.isInvolveReportPic" dict-type-code="BOOLEANS" :prop-enum="{domainCode:'marketing',appCode:'slm'}" />
        <template v-if="[1,'1'].includes(freezeDTO.isInvolveReportPic)">
          <QupListItem label="最近报图时间" :value="$trimHMS(freezeDTO.lastReportPicTime)" />
          <QupListItem label="最近报图面积(㎡)" :value="freezeDTO.lastReportPicArea || 0" />
        </template>
        <QupListItem label="是否涉及整改保证金" :value="freezeDTO.isInvolveDeposit" dict-type-code="BOOLEANS" :prop-enum="{domainCode:'marketing',appCode:'slm'}" />
        <QupListItem label="解冻范围" :span="24">
          <FreezeTable :table-data="detail.rangeDTOS || []" type="view" :is-freeze="false" />
        </QupListItem>
        <QupListItem v-if="freezeDTO.reportType !== 'B'" label="解冻附件" :span="24">
          <c-file-list :uploadable="false" :editable="false" :model-id="id" view-type="list" type-code="ACCESS074" />
        </QupListItem>
      </QupList>
    </c-title>
    <c-title title="BPM审核信息">
      <QupList :column="3" sep="：" default-value="" label-position="right" label-width="130">
        <QupListItem :value="detail.createBy" label="申请人" />
        <QupListItem :value="detail.createTime" label="申请时间" />
        <!-- <QupListItem :value="detail.authorityReviewTime" label="审批结束时间" /> -->
        <!-- <QupListItem label="审批结果" :value="detail.authorityReviewResult" dict-type-code="REVIEW_RESULT" :prop-enum="{domainCode:'marketing',appCode:'slm'}" /> -->
        <QupListItem label="变更进度" :value="detail.schedule" dict-type-code="CTM_CUS_ARCHIVE_CHANGE_PROGRESS" :prop-enum="{domainCode:'marketing',appCode:'slm'}" />
        <QupListItem :value="detail.applyNo" label="BPM单号" />
        <!-- <QupListItem :value="detail.authorityReviewAdvice" label="审批意见" /> -->
      </QupList>
      <Options :data="detail.opinionDTOS" />
    </c-title>
    <div class="btn-center">
      <c-button type="primary" @click="handleGoBack">返回</c-button>
    </div>
  </c-back-wrap>
</template>
<script>
import { freezeAndThawDetail } from '@/api/channelTask2/freezeAndThaw'
import FreezeTable from './freezeTable'
import CustomerBaseInfoView from '../../components/CustomerBaseInfoView'
import CustomerBaseInfoViewArchive from './CustomerBaseInfoView'
import Options from '../../components/Options'

export default {
  name: 'ThawDetail',
  components: {
    FreezeTable,
    CustomerBaseInfoView,
    CustomerBaseInfoViewArchive,
    Options
  },
  props: {
    id: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      detail: {},
      loading: false
    }
  },
  computed: {
    freezeDTO() {
      return this.detail.freezeDTO || {}
    }
  },
  created() {
    this.getDetailData()
  },
  methods: {
    getDetailData() {
      this.loading = true
      return freezeAndThawDetail(this.id).then(res => {
        this.detail = res.data
      }).finally(() => {
        this.loading = false
      })
    },
    handleGoBack() {
      this.$pageStack.pop()
    }
  }
}
</script>
<style lang="scss" scoped>
.change-table-title{
  display: flex;
  justify-content: flex-start;
  align-items: center;
  &>span{
    color: #333;
    font-size: 16px;
    font-weight: 600;
    margin-right: 10px;
  }
}
</style>
